/****************************************************************************
 * Application   : Freekick Desktop Manager
 * Author        : sfreekick
 * Email         : sfreekick@gmail.com
 * Copyright     : (C) 2008 sfreekick
 * **************************************************************************/

/****************************************************************************
 *  This file is part of FreeKickManager.
 *
 *  FreeKickManager is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  FreeKickManager is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with FreeKickManager. If not, see <http://www.gnu.org/licenses/>.
 ****************************************************************************/

using System;
using System.Windows.Forms;
using System.Drawing;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

namespace FKLineup
{
	[Serializable]
	public class Object
    {
        #region Private Fields

        protected Canvas canvas;
        protected int x, y;
        protected int type;
        protected object entity = null;
        protected bool selected;
        
        [NonSerialized()]
        protected Form window = null;

        #endregion

        #region Properties

        public Canvas Canvas
        {
            get 
            {
                return canvas;
            }
            set
            {
                canvas = value;
            }
        }

        public int X
        {
            get
            {
                return x;
            }
            set
            {
                x = value;
            }
        }

        public int Y
        {
            get
            {
                return y;
            }
            set
            {
                y = value;
            }
        }

        public int Type
        {
            get
            {
                return type;
            }
            set
            {
                type = value;
            }
        }

        public object Entity
        {
            get
            {
                return entity;
            }
            set
            {
                entity = value;
            }
        }

        public bool Selected
        {
            get
            {
                return selected;
            }
            set
            {
                selected = value;
            }
        }

        public Form Window
        {
            get
            {
                return window;
            }
            set
            {
                window = value;
            }
        }

        #endregion

        #region Methods

        public Object()
        {
            this.canvas = null;
            this.x = 1;
            this.y = 1;
            this.selected = false;
            this.entity = null;
        }

		public Object(object ent)
		{
            this.canvas = null;
			this.x = 1;
			this.y = 1;
			this.selected = false;
            this.entity = ent;
		}

		public Object(object ent, int x, int y)
		{
            this.canvas = null;
			this.x = x;
			this.y = y;
			this.selected = false;
            this.entity = ent;
		}

		public virtual void draw(Graphics g)
		{
			Pen p = new Pen(Color.Black,1);
			g.DrawRectangle(p,x,y,50,50);
		}

		public virtual bool hit(int cx, int cy)
		{
			return false;
		}

		public virtual Rectangle getRectangle()
		{
			return new Rectangle(0,0,0,0);
		}

		public virtual Point getCenter()
		{
			return new Point(0,0);
		}

        public virtual void setCenter(int x, int y)
        {
            this.x = x;
            this.y = y;
        }

        public virtual Rectangle getActiveZone()
        {
            return new Rectangle(0, 0, 0, 0);
        }

        #endregion
	}
}
